package org.abc.fund.repository.funds;

import org.abc.fund.entity.funds.FundCompany;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;
import java.util.Optional;

public interface FundCompanyRepository extends JpaRepository<FundCompany, Long> {

    // 🔍 名称模糊查找
    List<FundCompany> findByNameContaining(String keyword);

    // 🔍 简称模糊查找
    List<FundCompany> findByShortNameContaining(String keyword);

    // 🔍 按评级查找
    List<FundCompany> findByRating(String rating);

    // 🔍 名称或简称模糊查找
    List<FundCompany> findByNameContainingOrShortNameContaining(String name, String shortName);

    // 🔍 分页 + 模糊查找
    Page<FundCompany> findByNameContainingOrShortNameContaining(String name, String shortName, Pageable pageable);

    Optional<FundCompany> findByName(String name);
}
